package Proc::RPC::Result;

require 5.003;
use Moose;

has 'stdout' => 
(
  is => 'rw',
  isa => 'Str',
  default => '',
);

has 'stderr' => 
(
  is => 'rw',
  isa => 'Str',
  default => '',
);

has 'status' => 
(
  is => 'rw',
  isa => 'Int',
  default => 0,
);

has 'result' => 
(
  is => 'rw',
  isa => 'Ref',
  default => sub { [] },
);

has 'pid' =>
(
	is => 'rw',
	isa => 'Int',
);

use overload bool  => \&to_bool,
			q("") => \&to_string,
             fallback => 1;

sub to_bool 
{
  my $self = shift;

  !$self->status;
}


sub to_string
{
	my $self = shift;
	return	"PID:    ".$self->pid."\n".
			"STDOUT: ".$self->stdout."\n".
			"STDERR: ".$self->stderr."\n".
			"STATUS: ".$self->status."\n".
			"RESULT: ".$self->result."\n";
}
1;
